﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using DevExpress.XtraBars.Docking2010.Views.WindowsUI;
using DevExpress.XtraRichEdit;
using DTO;
using DAO;
namespace CafeApp
{
    
    public partial class frmMain : RibbonForm
    {
        //WindowsUIButton customBackButton;
        private bool mouseIsDown = false;
        private Point firstPoint;
        private bool mFormWindowState = false;
        public frmMain()
        {
            InitializeComponent();
            InitSkinGallery();

        }
        void InitSkinGallery()
        {
            
        }


        private void frmMain_Paint(object sender, PaintEventArgs e)
        {
            
            e.Graphics.DrawRectangle(Pens.Black, new Rectangle(0, 0, this.Width - 1, this.Height - 1));
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            this.DoubleBuffered = true;
            this.Paint += new PaintEventHandler(frmMain_Paint);
        }
        //static public int mx = 0;
        //static public int my = 0;
        // code demo border 

        private void btn_formMain_close_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btn_formMain_close_MouseHover(object sender, EventArgs e)
        {
            btn_formMain_close.ImageLocation = "../../image/32x32/Closehover_32.png";
        }
        private void btn_formMain_close_MouseLeave(object sender, EventArgs e)
        {
            btn_formMain_close.ImageLocation = "../../image/32x32/Close_32.png";
        }
        
        private void tableLayoutPanel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (mouseIsDown)
            {
                // Get the difference between the two points
                int xDiff = firstPoint.X - e.Location.X;
                int yDiff = firstPoint.Y - e.Location.Y;

                // Set the new point
                int x = this.Location.X - xDiff;
                int y = this.Location.Y - yDiff;
                this.Location = new Point(x, y);
            }
        }

        private void tableLayoutPanel1_MouseDown(object sender, MouseEventArgs e)
        {
            firstPoint = e.Location;
            mouseIsDown = true;
        }

        private void tableLayoutPanel1_MouseUp(object sender, MouseEventArgs e)
        {
            mouseIsDown = false;
        }

        private void tableLayoutPanel1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            
            if (mFormWindowState)
                this.WindowState = FormWindowState.Normal;
            else
                this.WindowState = FormWindowState.Maximized;
            mFormWindowState = !mFormWindowState;
        }

        private void btn_formMain_maxmize_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            mFormWindowState = true;
        }

        private void btn_formMain_minmize_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void tileBar_Menu_HoaDon_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
        }

        private void tileBar_Menu_NhanVien_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
            frmEmployees frm = new frmEmployees();
            frm.MdiParent = this;
            frm.Show();
        }

        private void tileBar_Menu_Ban_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
        }

        private void tileBar_Menu_HeThong_ItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
        }
    }
}